import request from '@/utils/request'

export const SliceUpload = async (data) => {
  return request({
    url: '/v1/departmentWork/periodReport/sliceUpload/',
    method: 'post',
    timeout: 60000,
    data,
  })
}

export const MergeUpload = async (data) => {
  return request({
    url: '/v1/departmentWork/periodReport/mergeUpload/',
    method: 'post',
    timeout: 60000,
    data,
  })
}

export const GetBelongReport = (ft, page, page_size, isd = 0) => {
  return request({
    url: '/v1/departmentWork/periodReport/belong/',
    method: 'get',
    params: { ft, page, page_size, isd },
  })
}

export const DelBelongReport = (rid, action) => {
  return request({
    url: '/v1/departmentWork/periodReport/belong/',
    method: 'delete',
    params: { rid, action },
  })
}

export const GetStatReport = (rt, uid, start, end) => {
  return request({
    url: '/v1/departmentWork/periodReport/adminReports/',
    method: 'get',
    params: { rt, uid, start, end },
  })
}

export const GetZipReports = (rt, uid, start, end) => {
  return request({
    url: '/v1/departmentWork/periodReport/adminReportsPackage/',
    method: 'get',
    params: { rt, uid, start, end },
  })
}

export const PostMarkReport = (data) => {
  return request({
    url: '/v1/departmentWork/periodReport/adminMarkReport/',
    method: 'post',
    data,
  })
}

export const GetExamineReport = (rt, area, examine, mark, page, page_size) => {
  return request({
    url: '/v1/departmentWork/periodReport/examineList/',
    method: 'get',
    params: { rt, area, examine, mark, page, page_size },
  })
}
export const PutExamineReport = (data) => {
  return request({
    url: '/v1/departmentWork/periodReport/examineList/',
    method: 'put',
    data,
  })
}

// 查询定期报告文件列表，各种类型的人员查询
export const GetPeriodicReportFile = (t, page, pageSize, aut = 'own') => {
  return request({
    url: '/v1/departmentWork/periodReport/fileList/',
    method: 'get',
    params: { t, page, page_size: pageSize, aut },
  })
}

// 审核定期报告文件
export const ExaminePeriodicReportFile = (data) => {
  return request({
    url: '/v1/departmentWork/periodReport/examine/',
    method: 'put',
    data,
  })
}

// 创建晨会纪要
export const CreateEarlyReference = (data) => {
  return request({
    url: '/v1/departmentWork/periodReport/early/',
    method: 'post',
    data,
  })
}

export const MarkEarlyReference = (data) => {
  return request({
    url: '/v1/departmentWork/periodReport/early/mark/',
    method: 'post',
    data,
  })
}

export const GetMarkEarlyReference = (start, end) => {
  return request({
    url: '/v1/departmentWork/periodReport/early/mark/',
    method: 'get',
    params: { start, end },
  })
}

// 查询晨会纪要(含指定成员或全部)
export const GetEarlyReference = (
  date,
  uid = null,
  exporter = null,
  include_all = 1
) => {
  return request({
    url: '/v1/departmentWork/periodReport/early/',
    method: 'get',
    params: { date, uid, exporter, include_all },
  })
}

// 管理创建晨会纪要
export const AdminCreateEarlyReference = (data) => {
  return request({
    url: '/v1/departmentWork/periodReport/earlyAdminCreate/',
    method: 'post',
    data,
  })
}

// 删除晨会纪要条目
export const DeleteEarlyReference = (rid) => {
  return request({
    url: '/v1/departmentWork/periodReport/early/',
    method: 'delete',
    params: { rid },
  })
}

// 删除定期报告文件记录
export const DeletePeriodReport = (rid, action) => {
  return request({
    url: '/v1/departmentWork/periodReport/',
    method: 'delete',
    params: { rid, action },
  })
}

// 报告回收站
export const RestorePeriodReport = (t, page, page_size) => {
  return request({
    url: '/v1/departmentWork/periodReport/restore/',
    method: 'get',
    params: { t, page, page_size },
  })
}

// 按日期查询报告
export const GetDatePeriodReport = (date) => {
  return request({
    url: '/v1/departmentWork/periodReport/dateFileList/',
    method: 'get',
    params: { date },
  })
}


